Skip to content

Ordering#76

Open
itimky wants to merge 3 commits into
aykut:masterfrom
itimky:ordering
Open

Ordering#76
itimky wants to merge 3 commits into
aykut:masterfrom
itimky:ordering

Conversation

@itimky

@itimky itimky commented Oct 20, 2018

Copy link
Copy Markdown

There are cases when row-level deadlocks occur on simultaneous update, celery task & Django view for instance.
If update order is preserved (order by pk) there are no more deadlocks.
Implemented via CTE.
Added "ordered=False" for backward compatibility & keep overhead away if ordering not needed.

@mkomitee

mkomitee commented Sep 5, 2019

Copy link
Copy Markdown

I'm not sure that it matters much at this point, but this only ensures sorting within batches, so if you use the batch feature you're still exposed to the potential for deadlocks.

@itimky

itimky commented Sep 10, 2019

Copy link
Copy Markdown
Author

Correct, but it's possible to sort your data before passing it to bulk_update, so the sorting order will be preserved across all batches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants